package com.sline.Test;

import java.lang.reflect.Method;
import java.util.ArrayList;

public class Test1 {
    public static void main(String[] args) throws Exception {
        ArrayList<Integer> arr = new ArrayList<>();
        arr.add(111);
        arr.add(222);

        Class clazz = Class.forName("java.util.ArrayList");//ArrayList.class;
        Method method = clazz.getMethod("add", Object.class);
        method.invoke(arr, "abc");
        System.out.println(arr);
    }
}
